//
//  DDWorthViewController.m
//  DingDongZP
//
//  Created by Jyh on 16/3/13.
//  Copyright © 2016年 iyhjiang.com. All rights reserved.
//

#import "DDWorthViewController.h"
#import "DDWorthCollectionCell.h"
@interface DDWorthViewController () <UICollectionViewDelegate,  UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>

@property (nonatomic, strong) UIImageView *worthLogo;
@property (weak, nonatomic) IBOutlet UICollectionView *collectionView;

@end

@implementation DDWorthViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.collectionView.backgroundColor = [UIColor whiteColor];
    [self.collectionView registerClass:[DDWorthCollectionCell class] forCellWithReuseIdentifier:@"DDWorthCollectionCell"];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark
#pragma mark - UICollectionViewDelegate

-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}

//UICollectionView被选中时调用的方法
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell * cell = (UICollectionViewCell *)[collectionView cellForItemAtIndexPath:indexPath];
    cell.backgroundColor = [UIColor whiteColor];
}

#pragma mark
#pragma mark - UICollectionViewDataSource

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 30;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    DDWorthCollectionCell *cell = (DDWorthCollectionCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"DDWorthCollectionCell" forIndexPath:indexPath];
    
    cell.imageView.image = nil;
    cell.nameLabel.text = nil;
    
    return cell;
}

#pragma mark
#pragma mark - UICollectionViewDelegateFlowLayout

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    
    return CGSizeMake(kScreenWidth/3, kScreenWidth/3);
}

@end
